import { tabBar } from '@/pages.json';
/**
 * 跳转
 */
export const toJumpUrl = (jumpUrl: string) => {
	if (!jumpUrl) {
		return;
	}
	const cleanUrl = jumpUrl.startsWith('/') ? jumpUrl.substring(1) : jumpUrl;
	const index = tabBar.list.findIndex((item: any) => {
		return cleanUrl == item.pagePath;
	});
	if (index < 0) {
		uni.$hxRouter.push({
			url: jumpUrl,
		});
	} else {
		uni.$hxRouter.push({
			url: jumpUrl,
			type: 'switchTab',
		});
	}
};
